﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Project.WinForms
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        private void ButtonDelete_Click_1(object sender, EventArgs e)
        {
            object selected = TransportsListBox.SelectedItem;
            TransportsListBox.Items.Remove(selected);
        }

        private void ButtonAdd_Click_1(object sender, EventArgs e)
        {
            TransportCreatorForm creatorForm = new TransportCreatorForm();
            creatorForm.ShowDialog();
            Route route = new Route();
            if (creatorForm.transport != null)
            {
                TransportsListBox.Items.Add(creatorForm.transport);
                route.AddTransport(creatorForm.transport);
            }
        }
    }
}
